var status = -1;
var selectionLog = [];

function start() {
    action(1, 0, 0)
}

function action(f, e, d) {
    if (im.getServerName().equals("BMS单机") && im.getServerName().equals("BMS至尊体验服") && !im.getServerName().equals("BMS至尊")) {
        im.playerMessage(1, " 使用环境异常，请还原服务端配置。");
        im.dispose();
        return
    }
    if (status == 0 && f == 0) {
        im.dispose();
        return
    }(f == 1) ? status++ : status--;
    selectionLog[status] = d;
    var c = -1;
    if (status <= c++) {
        im.dispose()
    } else {
        if (status === c++) {
            im.dispose();
            var g = im.getItemId();
            var b = [80002831, 80002845, 80002846];
            var a = b[g - 2630917];
            im.teachSkill(a, 0, -1);
            im.teachSkill(a, 1, 0);
            im.sendNormalTalk("#b#s " + a + "# #q" + a + "# (永久)#k技能已获得！", 4, 9010000, false, true);
            im.gainItem(g, -1)
        }
    }
};